package com.webapp.manager.impl;

import java.util.List;

import com.webapp.basedata.Type;
import com.webapp.dao.impl.TypeDaoImpl;
import com.webapp.manager.TypeManager;

public class TypeManagerImpl implements TypeManager {

	@Override
	public void addType(String name) {
		 TypeDaoImpl daoImpl = new TypeDaoImpl();
		 Type type = new Type();
		 type.setName(name);
		 daoImpl.addType(type);
	}

	@Override
	public void deleteTypeById(int id) {
		 TypeDaoImpl daoImpl = new TypeDaoImpl();
		 daoImpl.deleteType(id);
	}

	@Override
	public Type findTypeByName(String name) {
		TypeDaoImpl daoImpl = new TypeDaoImpl();
		Type type = daoImpl.findTypeByName(name);
		return type;
	}

	@Override
	public Type findTypeById(int id) {
		 TypeDaoImpl daoImpl = new TypeDaoImpl();
		 Type type = daoImpl.findTypeById(id);
		return type;
	}

	@Override
	public void modifyType(int id,String name) {
		 TypeDaoImpl daoImpl = new TypeDaoImpl();
		 Type type = daoImpl.findTypeById(id);
		 type.setName(name);
		 daoImpl.modifyType(type);
	}

	@Override
	public List<Type> searchTypes() {
		return new TypeDaoImpl().searchTypes();
	}

}
